<template>
  <div class="site-table-page">
    <el-table
      :data="sites"
      style="width: 100%"
      header-cell-class-name="header-cell-class-name"
      stripe
      border
    >
      <el-table-column
        prop="number"
        label="网址"
        align="center">
        <template slot-scope="{ row }">
          <div>{{ row.link }}</div>
        </template>
      </el-table-column>
      <!--<el-table-column prop="amount" label="验证状态" align="center">-->
        <!--<template slot-scope="{ row }">-->
          <!--<div>{{ status[row.status-1] }}</div>-->
        <!--</template>-->
      <!--</el-table-column>-->
      <el-table-column
        prop="channel"
        label="主站点标记"
        align="center"
      >
        <template slot-scope="{ row }">
          <div>{{ row.tag }}</div>
        </template>
      </el-table-column>

      <el-table-column
        prop="createrTime"
        label="操作"
        align="center"
      >
        <template slot-scope="{ row }">
          <div>
            <el-popconfirm
              title="确认删除站点吗？"
              @onConfirm="()=>{editItem(row.level)}"
            >
              <el-button slot="reference">删除</el-button>
            </el-popconfirm>
            <!--<el-button type="primary" @click.native="editItem(row.level)">删除</el-button>-->
            <!--<el-dropdown trigger="click">-->
              <!--<el-button type="primary" style="width: 120px;">-->
                <!--管理站点<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
              <!--</el-button>-->
              <!--<el-dropdown-menu slot="dropdown" style="width: 120px;text-align: center;" split-button="true" >-->
                <!--&lt;!&ndash;<el-dropdown-item>验证</el-dropdown-item>&ndash;&gt;-->
                <!--&lt;!&ndash;<el-dropdown-item>编辑</el-dropdown-item>&ndash;&gt;-->
                <!--<el-dropdown-item @click.native="editItem(row.level)">删除</el-dropdown-item>-->
              <!--</el-dropdown-menu>-->
            <!--</el-dropdown>-->
          </div>
        </template>
      </el-table-column>

    </el-table>
  </div>
</template>

<script>
  import {trace} from "../../../utils/trace"
  import {mapGetters} from "vuex"
  import {state} from  "../../../store/modules/user"

  export default {
    components: {},
    props: {},
    data() {
      return {
        status:["未验证","已验证","验证失败"],
        // tableList: [
        //   {
        //     link: "https://tracing.glpro.io/",
        //     status: 1,
        //     tag: "主站点",
        //    btn:"管理站点"
        //   },
        //   {
        //     link: "https://tracing.glpro.io/",
        //     status: 1,
        //     tag: "主站点",
        //     btn:"管理站点"
        //   }
        // ],

      };
    },
    watch: {},
    computed: {
      ...mapGetters([
        'sites',"name"
      ])


    },
    methods: {
      showSubmenu:function (value) {
        trace("showSubmenu",value);

      },

      editItem:function (level) {
        trace("editItem",level)


        this.$store.dispatch('verify/delVerifySite', {level}).then((data) => {
          trace("删除站点---data",data)
          this.verify();
        }).catch((err) => {
          trace("err=",err)
        })
      }
    },
    created() {
      // this.tableList= [
      //   {
      //     link: "https://tracing.glpro.io/",
      //     status: 1,
      //     tag: "主站点",
      //     btn:"管理站点"
      //   },
      //   {
      //     link: "https://tracing.glpro.io/",
      //     status: 1,
      //     tag: "主站点",
      //     btn:"管理站点"
      //   }
      // ];

      // trace("sites1",this.sites,this.name)

    },
    mounted() {
      // trace("sites2",this.sites)
    }
  };
</script>
<style lang="scss" scoped>
  ::v-deep .header-cell-class-name {
    background: #ecf0f3;
  }
  ::v-deep .el-submenu__title{
    background-color: rgb(255, 255, 255) !important;
  }
  .pagination-box {
    margin: 15px 0;
    text-align: right;
  }
</style>
